package com.sy.jtabytetcc.service;

import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sy.jtabytetcc.dao.RepoAReposity;
import com.sy.jtabytetcc.pojo.RepoA;

@Service("repoAServiceCancel")
public class RepoAServiceCancel implements IRepoAService {
	@Autowired
	private RepoAReposity repoAReposity;

	@Override
	@Transactional
	public void tradingItems(Integer id,Integer targetRepoId,  Integer count) {
		Optional<RepoA> repoAOpt = repoAReposity.findById(id);
		RepoA repoA = repoAOpt.orElse(new RepoA());
		//将冻结的恢复
		repoA.setFreeze(repoA.getFreeze()-count);
		repoAReposity.save(repoA);
	}


}
